Skip to content

fix(mcp): use the API-selected POD deadline - #379

Open
alosec wants to merge 11 commits into
mainfrom
fix/mcp-pod-lfd-parity
Open

alosec wants to merge 11 commits into
mainfrom
fix/mcp-pod-lfd-parity

Conversation

@alosec

@alosec alosec commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Review evidence update: checked-in synthetic JSON:API contract projections now cover reported facility, opted-in calculated, carrier-withheld/facility-visible and unknown POD selections. Their field nesting and visibility rules were checked against the V2 serializer and serializer tests. Both MCP read paths consume the same fixture responses; build/check and 398 tests pass, with one live-token test skipped. This is source-backed client contract coverage, not captured production data or live deployment validation.

Both get_container and t49:container/{id} now use the account-visible deadline selected by the API in import_deadlines.pod.unified, through one shared resolver. Missing or withheld values remain unknown even when a legacy pickup_lfd exists. Tool display, countdown, and urgency use the terminal-local calendar; the resource uses the same deadline and calendar calculation.

Synchronized with main while preserving custom-field loading and metadata. Verified the nested selected-value/source contract against the backend V2 container serializer. Regression coverage includes missing/withheld values, date-only deadlines, DST, missing/invalid timezones, and tool/resource parity.

Validation: workspace build, monorepo lint/type checks, and 394 tests passed (one live API test skipped). Current-head CI is running.

@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api Ready Ready Preview Oct 19, 2026 4:43am UTC

Request Review

@dodeja
dodeja marked this pull request as ready for review September 30, 2026 04:19
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T04:44:45.460882Z 119ac5b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63a0d3c9c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/mcp/src/tools/get-container.ts Outdated
Comment thread packages/mcp/src/tools/get-container-lfd.test.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fa50c3d48

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/mcp/src/tools/get-container.ts
get_container and the t49:container/{id} resource read the headline Last
Free Day from import_deadlines.pod.unified through a shared
resolvePodDeadline helper. A missing or withheld value stays unknown and
never falls back to the legacy pickup_lfd. Adds checked-in serializer
contract fixtures and tool/resource parity tests.

Replays the branch's commits and its main-sync merge onto current main.

Co-authored-by: Akshay Dodeja <dodeja@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ceecd111c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +242 to +243
const { value: pickupLfd, source: pickupLfdSource } =
resolvePodDeadline(importDeadlines);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply the POD resolver to container lists

When list_containers returns either its default compact view or the full view, it still requests mapped SDK results: mapContainer populates demurrage.pickupLfd from legacy attrs.pickup_lfd (sdks/typescript-sdk/src/client/mappers.ts:315), and the compact projection emits that value (packages/mcp/src/tools/compact-rows.ts:42). Consequently, whenever the legacy and pod.unified.current_value values disagree, fleet worklists continue reporting an inland or superseded deadline while the detail, resource, and shipment paths report the selected POD deadline; route list results through this resolver as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 14bf8e9. list_containers now runs every mapped row through resolvePodDeadline before projection, so both the compact view (pickup_lfd, new pickup_lfd_source) and the full view (demurrage.pickupLfd, new demurrage.pickupLfdSource) carry the API-selected POD deadline instead of the SDK mapper's legacy pickup_lfd. A missing or withheld unified value stays unknown, with no legacy fallback. The SDK mapper itself is unchanged; the override lives in the MCP tool.

New tests send the four checked-in contract fixtures through the real SDK mapContainerList and then list_containers in both views. They failed before the change and pass now. The detail tool, the container resource and get_shipment_details already used the resolver (807732e, ec017b3), so all four MCP read paths now agree.

Also merged current main (2f036ae). Main's #437 event-value test expected the legacy field from get_container; its fixture now supplies import_deadlines.pod.unified (212e213).

Out of scope here and unchanged: server-side pickup_lfd filtering/sorting and summarize_containers pickup_lfd_date grouping are computed by the API.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-verified after merging main (registry/toolset refactor #447, core read tools #449) in 73b4aa1.

  • The registry still wires list_containers to executeListContainers, which maps every row through withSelectedPodDeadline (resolvePodDeadline) before the compact projection, so both views carry the API-selected POD deadline.
  • Mutation check: replacing rawItems.map(withSelectedPodDeadline) with rawItems fails both uses the same selections in compact list_containers rows and ... full list_containers rows in get-container-lfd.test.ts (2 failed / 21 passed; the legacy 2099-12-31 leaks through). Restored, 23/23 pass.
  • On the merged tree: vp run check passes, vp run test passes (153 + 419 + 748 tests), vp run build passes, and the protocol smoke passes for all six CI protocol versions.

No further code change was needed for this thread.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main moved again (#460, #467), so 119ac5b merges it on top of the Postman bot commit. Same result on that tree. The list_containers mutation fails both list tests (2 failed / 21 passed) and passes 23/23 once restored. Check, test (153 + 422 + 750) and build pass, and the protocol smoke passes for all six versions.

@dodeja
dodeja force-pushed the fix/mcp-pod-lfd-parity branch from 40f4a85 to 0ceecd1 Compare October 17, 2026 06:53
get_shipment_details still listed each included container's legacy
pickup_lfd, so it could show a different Last Free Day from get_container
for the same container. Its container summaries now go through
resolvePodDeadline and also return pickup_lfd_source. A withheld or
missing unified value stays null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dodeja and others added 5 commits October 17, 2026 00:36
…fixture

Main's #437 event-value test expected get_container to report the legacy
flat pickup_lfd. This branch reads the deadline only from
import_deadlines.pod.unified, so the fixture now supplies that value and a
different legacy value, keeping the check that event values never replace the
container's own deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDK list mapper fills demurrage.pickupLfd from the legacy flat
pickup_lfd, so compact and full list rows could show an inland or superseded
deadline while get_container, the container resource and
get_shipment_details showed the selected POD deadline. List rows now go
through resolvePodDeadline and carry the selection source; a missing or
withheld unified value stays unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The generated Postman collection commit (4230965) carries the bot's skip
marker, so no required check ran on the PR head. This empty commit gives the
head a CI run. It touches no files, so the Postman workflow does not fire again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73b4aa15a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +5 to +9
pod?: {
unified?: {
current_value?: string | null;
current_selection?: string | null;
} | null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Define the POD selection in the OpenAPI source

Add the new import_deadlines.pod.unified contract to docs/openapi.json before relying on this local shadow type. The current OpenAPI schema declares only pickup_lfd_terminal, pickup_lfd_rail, and pickup_lfd_line, so generated SDK types and public API documentation omit the fields now required by every MCP container read; because these paths use any, normal type checking and regeneration cannot detect that drift.

AGENTS.md reference: AGENTS.md:L23-L23

Useful? React with 👍 / 👎.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 119ac5b7b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +91 to +92
const mappedItems = Array.isArray(rawItems)
? rawItems.map(withSelectedPodDeadline)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Align LFD queries with the selected POD deadline

When the legacy pickup_lfd and pod.unified.current_value differ—the exact case handled here—this rewrite occurs only after the API has applied pickup_lfd filters, sorting, and pagination to the legacy field. An imminent selected POD deadline can therefore be excluded by an LFD window, while sorted pages can be out of order relative to the pickup_lfd returned here; filtering and sorting need to use the selected POD deadline server-side as well.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added risk:high Advisory path risk; current-head human review needed risk:unknown Advisory evidence unavailable or changed; no merge permission and removed risk:high Advisory path risk; current-head human review needed risk:unknown Advisory evidence unavailable or changed; no merge permission labels Oct 19, 2026

This branch was successfully deployed

1 active deployment
Preview — 92cc6e7d Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Advisory path risk; current-head human review needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants